<!DOCTYPE html>
<html lang="zh">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title><%= title || '药品在线招投标系统' %></title>
  <link rel="stylesheet" href="/public/styles.css">
</head>
<body>
  <header class="topbar">
    <div class="brand">
      <span class="brand-icon">💊</span>
      <div class="brand-text">
        <span class="brand-title">药品在线招投标系统</span>
        <span class="brand-subtitle">Pharma Tendering Platform</span>
      </div>
    </div>

    <% if (currentUser) { %>
      <nav class="nav-links">
        <a href="/dashboard" class="nav-link <%= currentPath === '/dashboard' ? 'nav-highlight' : '' %>">首页</a>
        <a href="/tenders" class="nav-link <%= (currentPath === '/tenders' || (currentPath.startsWith('/tenders/') && currentPath !== '/tenders/new')) ? 'nav-highlight' : '' %>">招标信息</a>
        <a href="/messages" class="nav-link <%= currentPath === '/messages' || currentPath.startsWith('/messages?') ? 'nav-highlight' : '' %>">留言板</a>
        <% if (currentUser.role === 'TENDERER') { %>
          <a href="/tenders/new" class="nav-link <%= currentPath === '/tenders/new' ? 'nav-highlight' : '' %>">发布招标</a>
        <% } %>
        <% if (currentUser.role === 'BIDDER') { %>
          <a href="/bids/my" class="nav-link <%= currentPath === '/bids/my' || currentPath.startsWith('/bids/tender') ? 'nav-highlight' : '' %>">我的投标</a>
        <% } %>
        <% if (currentUser.role === 'ADMIN') { %>
          <a href="/admin/users" class="nav-link <%= currentPath.startsWith('/admin') ? 'nav-highlight' : '' %>">用户管理</a>
        <% } %>
      </nav>
      <div class="user-chip">
        <div class="user-avatar"><span><%= currentUser.username?.slice(0,1).toUpperCase() %></span></div>
        <div class="user-meta">
          <strong><%= currentUser.username %></strong>
          <small><%= currentUser.role %></small>
        </div>
        <a href="/auth/logout" class="btn btn-ghost">退出</a>
      </div>
    <% } else { %>
      <nav class="nav-links">
        <a href="/auth/login" class="nav-link <%= currentPath === '/auth/login' ? 'nav-highlight' : '' %>">登录</a>
        <a href="/auth/register" class="nav-link <%= currentPath === '/auth/register' ? 'nav-highlight' : '' %>">注册</a>
      </nav>
    <% } %>
  </header>

  <main class="page">
    <div class="container">
      <%- body %>
    </div>
  </main>

  <footer class="footer">
    <div>© 2025 药品在线招投标系统 · 课程设计示例</div>
    <div class="footer-note">保障药品采购公开透明 · 提升投标效率</div>
  </footer>
</body>
</html>


